package com.swu.controller;

import com.swu.common.Result;
import com.swu.service.IAIService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 勾新杰
 * @version 1.0
 * @description: AI相关接口管理
 * @date 2025/6/10 17:24
 */
@Slf4j
@Tag(name = "AI相关接口管理")
@RestController
@RequestMapping("/ai")
@RequiredArgsConstructor
public class AIController {

    private final IAIService aiService;

    /**
     * 生成drools规则
     * @param ruleName 规则名称
     * @param ruleDescription 规则描述
     * @return 生成的drools规则
     */
    @GetMapping("/rule-content")
    @Operation(summary = "AI生成Drools规则")
    public Result<String> generateDroolsRule(String ruleName, String ruleDescription) {
        String s = aiService.generateDroolsRule(ruleName, ruleDescription);
        log.info("生成Drools规则成功：{}", s);
        return Result.success(s);
    }
}
